<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/16
 * Time: 19:13
 */
class Printer
{
    private static $obj=null;
    private  function _construct(){
        echo "mysql linked....";
    }
    public static  function getInstance(){
        if(is_null(self::$obj)){
            self::$obj=new Printer();
        }
        return self::$obj;

    }
}
$p1=Printer::getInstance();

$p2=printer::getInstance();
var_dump($p1);
var_dump($p2);
var_dump($p2==$p1);